<?php
/**
 * Created By Project
 * Author: 陈东
 * Copyright：陈东
 * Source Code：陈东
 * Explain：I shall not authorize for any other commercial purposes, law breakers must be prosecuted.
 */
namespace Admin\Controller;
use Think\Controller;

class JingController extends BaseController {
	static $dir = '/Uploadjimg/';
	
	public function index(){
		
		$this->display();
	}
	
	public function jupload(){
		if($_FILES['file']['error']==4){
			echo "没有选择文件！";
		}else{
			//print_r($_FILES['file']);
			$upload = new \Think\Upload();// 实例化上传类
			$upload->maxSize   =     10*1024*1024;// 设置附件上传大小(此处为10M)
			$upload->allowExts      =     array('mp3','mp4');// 设置附件上传类型
			$upload->rootPath  =      ".".self::$dir; // 设置附件上传根目录
			//上传单个文件
			$info   =   $upload->uploadOne($_FILES['file']);
			if(!$info) {
				//上传错误提示错误信息
				//$this->error($upload->getError());
				echo $upload->getError();
			}else{
				//上传成功 获取上传文件信息
				$imgpath = self::$dir.$info['savepath'].$info['savename'];
				echo $imgpath;
			}
		}

	}

}